#ifndef LIB_M_SHA1
#define LIB_M_SHA1

/*
  int sha1_valid

  Returns 1 if the char-arr named "hash" is a valid
  SHA-1 hash in hexadecimal form:
  length 40, characters in range 0-9, A-F or a-f

  Returns 0 if it's invalid.
*/
int sha1_valid(char *hash);

/*
  char *sha1_hash
  
  Applies the SHA-1 algorithm to the char-arr "input"
  and the hexadecimal form of the SHA-1 hash is stored
  into the char-arr "hash".

  WARNING: the function does not allocate memory for the
  char-arr "hash". Must've been already allocated with a length of
  at least 41.

  Returns a pointer to the char-arr "hash".
*/
char *sha1_hash(char *input, char *hash);

/*
  char *sha1_mangos

  Applies the SHA-1 algorithm to the string formed
  exactly like this: "USER:PASS". (without quotes)
  The function arguments "user" and "pass" are being
  converted to uppercase, concatanated having between them
  inserted the character ':'.

  If "makeStrUp" > 0 then "str_up" is applied to "user"
  and "pass". Usefull when the char-arr are already converted.

  The resulting SHA-1 hash is stored into the char-arr "hash".

  WARNING: the function does not allocate memory for the
  char-arr "hash". Must've been already allocated with a length of
  at least 41.

  Returns a pointer to the char-arr "hash".
*/
char *sha1_mangos(char *user, char *pass, char *hash, int makeStrUp);

#endif
